import { defineStore } from 'pinia'
import {getUsersApi} from '@/api/mine/mine'
import type { Data } from "@/api/mine/interface/usersApi";
import type {Content} from '@/api/public/interface/avocation'
interface stateType {
  data: Data | null
  selectedAvocationList: Content[]
}
const useMineStore = defineStore("mine", {
  state: (): stateType => {
    return {
      data: null,
      selectedAvocationList:[]
    };
  },
  actions: {
    // 获取用户信息列表
    async getUsers() {
      try {
        const result = await getUsersApi();
        this.data = result;
      } catch (error) {}
    },
    // 收集兴趣列表选择数据
    setSelectedAvocationList(list:Content[]) {
      this.selectedAvocationList = list
    }
  },
});

export { useMineStore };